

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>货道信息-查看</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="layui/css/layui.css" media="all">
		<link rel="stylesheet" href="layui/css/admin.css" media="all">
		<!--<style>
			.layui-body{
				overflow: scroll;
			}
		</style>-->
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-header"><span style="font-size: 22px; font-weight: bold;">货道信息-查看</span></div>
      <div class="layui-card-body" style="padding: 15px;">
        <table class="layui-hide" id="machine-list" lay-filter="demo" ></table>

			<script type="text/html" id="barDemo">
				<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
				<!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
			</script>
		
				 <div class="layui-form-item">
            <div class="layui-input-block" style="text-align: center; margin-left: -70px; margin-top: 10px;">
              <div class="layui-footer" style="left: 0;">
                <button class="layui-btn   select">更新库存</button>

				<button class="layui-btn  layui-btn-warm reset" id="back">返回</button>
              </div>
            </div>
          </div>
      </div>
    </div>
  </div>

    
  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script>
			layui.use(['form', 'table'], function() {
				var form = layui.form,
					table = layui.table;

				table.render({
					elem: '#machine-list',
					height: 332,
					url: '/demo/table/user/' //数据接口
						,cellMinWidth: 100,
					page: true //开启分页
						,
					cols: [
						[ //表头
							{
								field: 'id',
								title: '货道号',
								
								sort: true,
								fixed: 'left'
							}, {
								field: '',
								title: '商品名称',
								
							}, {
								field: '',
								title: '商品类型',
								
							}, {
								field: '',
								title: '商品单价',
								
							}, 
							{
								field: '',
								title: '实际库存数',
								
							},
							{
								field: '',
								title: '虚拟库存数',
								width: 100
							},
							{
								field: '',
								title: '货道状态',
								
							},{
								fixed: 'right',
								
								align: 'center',
								toolbar: '#barDemo'
							}
						]
					]
				});
				table.on('tool(demo)', function(obj) { //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
					var data = obj.data //获得当前行数据
						,
						layEvent = obj.event; //获得 lay-event 对应的值
					if(layEvent === 'detail') {
						layer.msg('查看操作');
					} else if(layEvent === 'del') {
						layer.confirm('真的删除行么', function(index) {
							obj.del(); //删除对应行（tr）的DOM结构
							layer.close(index);
							//向服务端发送删除指令
						});
					} else if(layEvent === 'edit') {
						layer.msg('编辑操作');
					}
				});

				

			});
			
			$('#back').click(function(){
					//alert(11)
					window.location.href="Cargo.html";
					return false;
					
				});
		</script>
</body>
</html>
